<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="*|/"><xsl:apply-templates/></xsl:template>

<xsl:template match="text()|@*"><xsl:value-of select="."/></xsl:template>

<xsl:template match='nbsp' name='nbsp'>
<xsl:text disable-output-escaping='yes'>&amp;nbsp;</xsl:text>
</xsl:template>

<xsl:template name="monthName">
 <xsl:param name="month"/>
 <xsl:choose>
   <xsl:when test="$month=1">Gennaio</xsl:when>
   <xsl:when test="$month=2">Febbraio</xsl:when>
   <xsl:when test="$month=3">Marzo</xsl:when>
   <xsl:when test="$month=4">Aprile</xsl:when>
   <xsl:when test="$month=5">Maggio</xsl:when>
   <xsl:when test="$month=6">Giugno</xsl:when>
   <xsl:when test="$month=7">Luglio</xsl:when>
   <xsl:when test="$month=8">Agosto</xsl:when>
   <xsl:when test="$month=9">Settembre</xsl:when>
   <xsl:when test="$month=10">Ottobre</xsl:when>
   <xsl:when test="$month=11">Novembre</xsl:when>
   <xsl:when test="$month=12">Dicembre</xsl:when>
   <xsl:otherwise>
     <xsl:value-of select="$month"/>
   </xsl:otherwise>
 </xsl:choose>
</xsl:template>

<xsl:template match="activities">
		<table bgcolor="#FFFFFF" class="body" border="0" cellspacing="0" cellpadding="0" width="100%">
		<tr><td class="CDBhead" width="1px">&#160;</td>
			<td class="CDBhead"><b><xsl:value-of select="@placeName"/></b> (<a href="activitiesCities.aspx">Cambia area geografica</a>)</td>
			<xsl:choose>
				<xsl:when test="/whole/@week=1 or (/whole/@future=-1)">
					<xsl:for-each select="/whole/wday">
						<td class="CDBhead" style="font-size:10px;" align="center">
							<xsl:value-of select="@shortname"/><br/>
							<xsl:value-of select="@dayOfMonth"/>
						</td>
					</xsl:for-each>
				</xsl:when>
				<xsl:when test="/whole/@future=1">
					<td colspan="5" class="body_10px" align="center">Quando
						</td>
					<td colspan="2" class="body_10px" align="center">
						Quanti
					</td>
				</xsl:when>
			</xsl:choose>
			<td class="CDBhead" width="1px">&#160;</td>
		</tr>
<xsl:for-each select="city">
<xsl:variable name="cityId"><xsl:value-of select="@placeId"/></xsl:variable>
<tr bgcolor="#FFFFFF">
	<td colspan="2" class="CDBf10" align="right" valign="middle" height="32px">
		<a href="/allactivities.aspx?place={@placeId}" class="body_10px_red"><b><xsl:value-of select="@placeName"/></b>&#160;</a>
	</td>
	<td colspan="7" class="CDBf10c" align="center">&#160;</td>
</tr>
				<xsl:for-each select="activity">
				<tr bgcolor="#FFFFFF">
					<td class="CDB"></td>
	<xsl:choose>
		<xsl:when test="@activityId=1695">
		<td class="CDBf10" align="left" height="22px" valign="middle">
			<a href="/activities/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/locs/tagliando.gif"/></a>
		</td>
		</xsl:when>
		<xsl:when test="@activityId=894">
		<td class="CDBf10" align="left" valign="middle" height="22px">
			<a href="/activities/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/locs/casablanca.gif"/></a>
		</td>
		</xsl:when>
		<xsl:when test="@activityId=992">
		<td class="CDBf10" align="left" valign="middle">
			<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/locs/colony.gif"/></a>
		</td>
		</xsl:when>
		<xsl:when test="@activityId=507">
		<td class="CDBf10" align="left" height="30px">
			<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/wineandfuns.gif"/></a>
		</td>
		</xsl:when>
		<xsl:when test="@activityId=1497">
		<td class="CDBf10" align="left" height="30px">
			<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/locs/pisagreca2.gif"/></a>
		</td>
		</xsl:when>
		<xsl:when test="@activityId=626">
		<td class="CDBf10" align="left" height="22px">
			<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><b><xsl:value-of select="@title"/></b></a>
		</td>
		</xsl:when>
		<xsl:when test="@activityId=535">
		<td class="CDBf10" align="left" height="24px">
			<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/iceskate.gif"/>&#160;<b><xsl:value-of select="@title"/></b></a>
		</td>
		</xsl:when>
		<xsl:when test="@activityId=18">
		<td class="CDBf10" align="left" height="24px">
			<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/locs/horafelizape.gif"/></a>
		</td>
		</xsl:when>
		<xsl:when test="@activityId=919">
		<td class="CDBf10" align="left" height="22px" valign="middle">
			<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/castagna.gif"/>&#160;<b><xsl:value-of select="@title"/></b></a>
		</td>
		</xsl:when>
		<xsl:when test="@activityId=563">
		<td class="CDBf10" align="left" height="22px" valign="middle">
			<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/smallbirthday.gif"/><xsl:value-of select="@title"/></a>
		</td>
		</xsl:when>
		<xsl:when test="@activityId=1205 or @activityId=1062 or @activityId=1200 or @activityId=1165 or @activityId=1212 or @activityId=1214 or @activityId=304">
		<td class="CDBf10" align="left" height="22px" valign="middle">
			<b><a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><xsl:value-of select="@title"/></a></b>
		</td>
		</xsl:when>
		<xsl:otherwise>
		<td class="CDBf10" align="left">
			<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><xsl:value-of select="@title"/></a>
		</td>
		</xsl:otherwise>
	</xsl:choose>
					<xsl:variable name="activityId"><xsl:value-of select="@activityId"/></xsl:variable>
					<xsl:for-each select="/whole/wday">
					<xsl:variable name="dayOfYear"><xsl:value-of select="@dayOfYear"/></xsl:variable>
					<xsl:variable name="hits">
						<xsl:value-of select="/whole/activities/weekDays[@day=$dayOfYear and @activityId=$activityId]/@hit"/>
					</xsl:variable>
					<td class="CDBf10c" align="center">
						<xsl:choose>
							<xsl:when test="$hits &gt; 0">
								<xsl:value-of select="$hits"/>
							</xsl:when>
							<xsl:otherwise>
								&#160;
							</xsl:otherwise>
						</xsl:choose>
					</td>
					</xsl:for-each>
					<td class="CDB"></td>
				</tr>
			</xsl:for-each>
	<xsl:for-each select="/whole/future[@placeId=$cityId]">
				<tr bgcolor="#FFFFFF">
					<td class="CDB"></td>
			<xsl:choose>
		<xsl:when test="@activityId=1497">
		<td class="CDBf10" align="left" height="30px">
			<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/locs/pisagreca2.gif"/></a>
		</td>
		</xsl:when>
		<xsl:when test="@activityId=890">
		<td class="CDBf10" align="left" valign="middle" height="39px">
			<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/locs/magazzini.gif"/></a>
		</td>
		</xsl:when>
		<xsl:when test="@activityId=18">
		<td class="CDBf10" align="left" height="24px">
			<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/locs/horafelizape.gif"/></a>
		</td>
		</xsl:when>
		<xsl:when test="@activityId=535">
		<td class="CDBf10" align="left" height="24px">
			<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/iceskate.gif"/>&#160;<b><xsl:value-of select="@title"/></b></a>
		</td>
		</xsl:when>
				<xsl:when test="@activityId=919">
				<td class="CDBf10" align="left" height="22px" valign="middle">
					<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/castagna.gif"/>&#160;<b><xsl:value-of select="@title"/></b></a>
				</td>
				</xsl:when>
				<xsl:when test="@activityId=507">
				<td class="CDBf10" align="left" height="30px">
					<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/wineandfuns.gif"/></a>
				</td>
				</xsl:when>
				<xsl:otherwise>
				<td class="CDBf10" align="left">
					<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><xsl:value-of select="@title"/></a>
				</td>
				</xsl:otherwise>
			</xsl:choose>
					<td class="CDBf10c" colspan="5" align="center">
						<font class="body_10px"><xsl:value-of select="@dd"/>&#160;
						<xsl:call-template name="monthName">
						<xsl:with-param name="month" select="@mm"/>
						</xsl:call-template>&#160;
						<xsl:value-of select="@aaaa"/></font>
						</td>
					<td class="CDBf9c" colspan="2" align="center">
						<xsl:value-of select="@howMany"/>
					</td>
				</tr>
	</xsl:for-each>
</xsl:for-each>

				<xsl:for-each select="future">
				<tr bgcolor="#FFFFFF">
					<td class="CDB"></td>
			<xsl:choose>
		<xsl:when test="@activityId=890">
		<td class="CDBf10" align="left" valign="middle" height="39px">
			<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/locs/magazzini.gif"/></a>
		</td>
		</xsl:when>
		<xsl:when test="@activityId=18">
		<td class="CDBf10" align="left" height="24px">
			<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/locs/horafelizape.gif"/></a>
		</td>
		</xsl:when>
		<xsl:when test="@activityId=535">
		<td class="CDBf10" align="left" height="24px">
			<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/iceskate.gif"/>&#160;<b><xsl:value-of select="@title"/></b></a>
		</td>
		</xsl:when>
				<xsl:when test="@activityId=919">
				<td class="CDBf10" align="left" height="22px" valign="middle">
					<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/castagna.gif"/>&#160;<b><xsl:value-of select="@title"/></b></a>
				</td>
				</xsl:when>
				<xsl:when test="@activityId=507">
				<td class="CDBf10" align="left" height="30px">
					<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><img border="0" src="/imgs/wineandfuns.gif"/></a>
				</td>
				</xsl:when>
				<xsl:otherwise>
				<td class="CDBf10" align="left">
					<a href="/activities/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><xsl:value-of select="@title"/></a>
				</td>
				</xsl:otherwise>
			</xsl:choose>
					<td class="CDBf10c" colspan="5" align="center">
						<font class="body_10px"><xsl:value-of select="@dd"/>&#160;
						<xsl:call-template name="monthName">
						<xsl:with-param name="month" select="@mm"/>
						</xsl:call-template>&#160;
						<xsl:value-of select="@aaaa"/></font>
						</td>
					<td class="CDBf9c" colspan="2" align="center">
						<xsl:value-of select="@howMany"/>
					</td>
				</tr>
				</xsl:for-each>
				<tr><td align="center" colspan="10">Clicka sul nome dell'attivita' per saperne di piu' e parteciparvi!</td>
				</tr>
			</table>

</xsl:template>

</xsl:stylesheet>